#include "oglRenderer.h"

USING_NAMESPACE_OXGE

oglTexture::oglTexture()
{
	m_type = GL_TEXTURE_2D;
	glGenTextures(1, &m_texid);
}

oglTexture::~oglTexture()
{
	glDeleteTextures(1,&m_texid);
}

void oglTexture::Apply()
{
	glEnable(m_type);
	glBindTexture(m_type, m_texid);
	
}



oglTexture& oglTexture::SetType( GLenum type )
{
	m_type = type;
	return *this;
}


void oglTextureUnit::SetTexture( oglTexture* pTexture )
{
	glActiveTextureARB(m_unitName);
	pTexture->Apply();
}